import { createRouter, createWebHistory } from 'vue-router';  // 引入 Vue Router 4.x

import Home from '../views/Home.vue'
import About from '../views/About.vue'



const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: About
  },
  {
    name: 'Vue子菜单1',
    path: '/menu1',
    component: Home
  },
  {
    name: 'Vue子菜单2',
    path: '/menu2',
    component: About
  }
]

// const router = new VueRouter({
//   routes: routes,
// })
const router = createRouter({
  history: createWebHistory(),
  routes,  // short for `routes: routes`
})

export default router
